<?php
/**
1.创建的产品原型
2.实际创建的
3.组装者
 */
class car{
    public $lunZi;
    public $boLi;
    public $cheJia;
    public function setLunZi($lunZi){
        $this->lunZi = $lunZi;
    }
    public function setBoLi($boLi){
        $this->boLi = $boLi;
    }
    public function setCheJia($cheJia){
        $this->cheJia = $cheJia;
    }
    public function show()
    {
        echo "lunzi:".$this->lunZi."\r\n";
        echo "boLi:".$this->boLi."\r\n";
        echo "cheJia:".$this->cheJia."\r\n";
    }
}

interface factory{
    function setLunzi();
    function setBoLi();
    function setCheJia();
    function getCar();
}
class QQFactory implements factory{
    public $car;
    public function __construct()
    {
        $this->car = new car();
    }
    function setLunzi(){
        $this->car->setLunzi("QQ轮子");
    }
    function setBoLi(){
        $this->car->setBoLi("QQ玻璃");
    }
    function setCheJia(){
        $this->car->setCheJia("QQ车架");
    }
    function getCar(){
        return $this->car;
    }
}
class FengTianFactory implements factory{
    public $car;
    public function __construct()
    {
        $this->car = new car();
    }
    function setLunzi(){
        $this->car->setLunzi("FengTian轮子");
    }
    function setBoLi(){
        $this->car->setBoLi("FengTian玻璃");
    }
    function setCheJia(){
        $this->car->setCheJia("FengTian车架");
    }
    function getCar(){
        return $this->car;
    }
}
class Assemble{
    function make(factory $factory){
        $factory->setLunzi();
        $factory->setBoLi();
        $factory->setCheJia();
        $factory->getCar()->show();
    }
}
(new Assemble())->make(new FengTianFactory());